#include <QPixmap>
#include "ReadPix.h"

ReadPix::ReadPix(QObject* parent):QThread(parent),loadPixMutex()
{
    isLoadPix_bool = false;
}

void ReadPix::setPixName(const QList<QString>& pixNames)
{
    pixName_List = pixNames;
}

void ReadPix::stopLoadPix()
{
    isLoadPix_bool = false;
}

void ReadPix::run()
{
    isLoadPix_bool = true;
    int ids = 0;
    for(auto A : pixName_List)
    {
        loadPixMutex.lock();
        if(isLoadPix_bool == false)
            break;
        QPixmap pix(A);
        emit loadPix(pix,ids);
        ++ids;
        loadPixMutex.unlock();
    }
}